package controllers

import (
	"github.com/astaxie/beego"
	"beeblog/models"
)

type MainController struct {
	beego.Controller
}

func (c *MainController) Get() {
	c.TplName = "home.html"
	c.Data["IsHome"] = true
	c.Data["IsLogin"] = checkAccount(c.Ctx)
	topics,err := models.GetAllTopics(c.Input().Get("cate"),true)
	if err != nil{
		beego.Error(err)
	}else {
		c.Data["Topice"] = topics
	}

	category,err := models.GetAllCategorier()
	if err != nil{
		beego.Error(err)
	}
	c.Data["Category"] = category
	}
